#include<iostream>
#include<vector>
#include<set>

using namespace std;

int numOfSubarrays(vector<int>& arr, int k, int threshold) {
    int res = 0, sum = 0;
    for (int i = 0; i < arr.size(); i++)
    {
        sum += arr[i];
        if (i < k - 1) continue;

        res += sum >= k * threshold;
        sum -= arr[i - k + 1];
    }
    return res;
}

int MLS(vector<int>& arr) {
    set<int> s;
    for (auto it : arr)  s.insert(it);

    int begin = 0, prev = 1, len = 1;
    for (auto it : s)
    {
        if (it == prev + 1)
            len = max(len, it - begin + 1);
        else
            begin = it;
        prev = it;
    }
    return len;
}